/**
  * ESUI (Enterprise Simple UI)
  * Copyright 2013 Baidu Inc. All rights reserved.
  *
  * @file 树样式
  * @author dbear
  */

@import "Variable.less";

@esui-tree-line-height: 2;
@esui-tree-selected-node-font-weight: normal;
@esui-tree-node-indent: 1.5em;
@esui-tree-selected-node-color: #333333;

.@{ui-class-prefix}-tree {
    ul, li {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    display: block;
    line-height: @esui-tree-line-height;
}

.@{ui-class-prefix}-tree-node {
    cursor: pointer;
    overflow: hidden;
}

.@{ui-class-prefix}-tree-node-indicator {
    text-indent: -5000px;
    vertical-align: middle;
    width: @esui-tree-node-indent;
    float: left;
}

// 节点文字
.@{ui-class-prefix}-tree-item-content {
    .ellipsis();

    .esui-tree-item-content-theme();
}

.@{ui-class-prefix}-tree-content-wrapper-selected {
    .@{ui-class-prefix}-tree-item-content {
        font-weight: @esui-tree-selected-node-font-weight;
        color: @esui-tree-selected-node-color;
        label {
            .esui-checkbox-virtual-box-checked-theme();
        }
    }
}

.@{ui-class-prefix}-tree-sub-root-expanded {
    display: block;
}
.@{ui-class-prefix}-tree-sub-root-collapsed {
    display: none;
}

.@{ui-class-prefix}-tree-hide-root {
    .@{ui-class-prefix}-tree-root {
        .@{ui-class-prefix}-tree-content-wrapper {
            display: none;
            .@{ui-class-prefix}-tree-node-indicator-level-0 {
                width: 0;
            }
        }
        .@{ui-class-prefix}-tree-sub-root {
            .@{ui-class-prefix}-tree-content-wrapper {
                display: block;
            }
        }
    }
}

.@{ui-class-prefix}-tree-angle {
    // 展开
    .@{ui-class-prefix}-tree-node-indicator-expanded {
        .eicons-icon(angle-down);
    }

    // 收起
    .@{ui-class-prefix}-tree-node-indicator-collapsed {
        .eicons-icon(angle-right);
    }
}

// 文件夹图标
.@{ui-class-prefix}-tree-folder {
    .@{ui-class-prefix}-tree-node-indicator-expanded {
        .eicons-icon(folder-open);
    }
    .@{ui-class-prefix}-tree-node-indicator-collapsed {
        .eicons-icon(folder);
    }
    .@{ui-class-prefix}-tree-node-indicator-empty {
        .eicons-icon(file);
    }
}

// 小三角
.@{ui-class-prefix}-tree-caret {
    .@{ui-class-prefix}-tree-node-indicator-expanded {
        .eicons-icon(caret-down);
    }
    .@{ui-class-prefix}-tree-node-indicator-collapsed {
        .eicons-icon(caret-right);
    }
}

// 要使用Web Font图标
.@{ui-class-prefix}-tree-icon {
    .@{ui-class-prefix}-tree-node-indicator {
        position: relative;
        &:before, span {
            text-indent: 0;
            .eicons-font-style();
            position: absolute;
            width: 100%;
            line-height: @esui-tree-line-height;
            left: 0;
            top: 0;
            text-align: center;
            .esui-tree-node-indicator-theme();
        }
    }

    .@{ui-class-prefix}-tree-node-indicator-previous,
    .@{ui-class-prefix}-tree-node-indicator-far-previous {
        &:before {
            content: '';
        }
    }
}

// 行hover效果
.@{ui-class-prefix}-tree-hoverable {
    .@{ui-class-prefix}-tree-content-wrapper:hover {
        .esui-tree-content-wrapper-hover-theme();
    }
}

.esui-tree-item-content-theme() {}
.esui-tree-node-indicator-theme() {}
.esui-tree-content-wrapper-hover-theme() {}